import _ from 'lodash';
import {isApp, isGroup, isMenu, isPermission} from "@jzl/utils/menu.js";

export const _isVE = (actionType) => {
  return actionType === 'edit' || actionType === 'view';
}

export const isGroupForm = (currentData, actionType) => {
  return actionType === 'createGroup' || (_isVE(actionType) && isGroup(currentData));
  /** && (this.actionType == 'edit' || this.actionType == 'view') **/
}

export const isMenuForm = (currentData, actionType) => {
  return actionType === 'createMenu' || (_isVE(actionType) && isMenu(currentData));
  /** && (this.actionType == 'edit' || this.actionType == 'view') **/
}

export const isAppForm = (currentData, actionType) => {
  return actionType === 'createApp' || (_isVE(actionType) && isApp(currentData));
  /**  && (this.actionType == 'edit' || this.actionType == 'view') **/
}

export const isPermissionForm = (currentData, actionType) => {
  return actionType === 'createPermission' || (_isVE(actionType) && isPermission(currentData));
}
